package com.ht.yml.tools;

import java.io.ByteArrayInputStream;
import java.util.Map;

/**
 * @author wangmin
 * @discription
 * @created 2024-12-30 10:50
 */
public class TesterForGenerateSameForSpringCloudConfig {
    public static void main(String[] args) throws Exception {
        Map<String, String> devConfigSource = ApplicationConfigUtils.readPropertyFile("D:\\恒太svn代码\\springcloud\\config\\data-center-dev.properties");
        Map<String, Object> devConfigYaml = YamlPropertiesUtils.convertProperties2YmlMap(devConfigSource);

        Map<String, String> testConfigSource = ApplicationConfigUtils.readPropertyFile("D:\\恒太svn代码\\springcloud\\config\\data-center-test.properties");
        Map<String, Object> testConfigYaml = YamlPropertiesUtils.convertProperties2YmlMap(testConfigSource);

        Map<String, String> proConfigSource = ApplicationConfigUtils.readPropertyFile("D:\\恒太svn代码\\cloudconfig\\config\\data-center-pro.properties");
        Map<String, Object> proConfigYaml = YamlPropertiesUtils.convertProperties2YmlMap(proConfigSource);

        String same1Str = YamlPropertiesUtils.compare(testConfigYaml, "test", proConfigYaml, "pro");
        Map<String, String> same1ConfigSource = ApplicationConfigUtils.readPropertyFile(new ByteArrayInputStream(same1Str.getBytes()));
        Map<String, Object> same1ConfigYaml = YamlPropertiesUtils.convertProperties2YmlMap(same1ConfigSource);

        YamlPropertiesUtils.compare(devConfigYaml, "dev", same1ConfigYaml, "same1");
    }

}
